import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'line_chart1_logic.dart';
import '../../../../widget/text/text_widget.dart';
import '../../../../common/app_resources.dart';

class LineChart1Page extends StatelessWidget {
  LineChart1Page({Key? key}) : super(key: key);

  final logic = Get.put(LineChart1Logic());
  final state = Get.find<LineChart1Logic>().state;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(
        left: 32,
        right: 32,
        top: 32,
        bottom: 32,
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          TextWidget(
            "Line Chart Sample1", TS_FF50E4FF_18_W4,
          ),
          const SizedBox(height: 20),
          Container(
            decoration: const BoxDecoration(
              color: AppColors.colorFF1B2339,
              borderRadius: BorderRadius.all(Radius.circular(8)),
            ),
            child: AspectRatio(
              aspectRatio: 1.23,
              child: Stack(
                children: [
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: [
                      const SizedBox(height: 37),
                      TextWidget("Monthly Sales", TS_FF50E4FF_32_W5,
                          textAlign: TextAlign.center),
                      const SizedBox(height: 37),
                      Expanded(
                        child: Padding(
                          padding: const EdgeInsets.only(right: 16, left: 6),
                          child: LineChart(state.sampleData,
                              duration: const Duration(milliseconds: 250)),
                        ),
                      ),
                      const SizedBox(
                        height: 10,
                      ),
                    ],
                  )
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
